/* 单伪元素法 */
.clearfix::after {
    content: "";
    display: block;
    clear: both;
}

/* 双伪元素法(推荐) */
.clearfix::before,
.clearfix::after {
    content: "";
    display: table;
}

.clearfix::after {
    clear: both;
}